import '../../scss/lease/lease.scss'
import $ from '../jquery/jquery.min.js';
import '../test/test.js';
import '../lease/customer.js'
import '../lease/carRental.js'
import '../lease/advertise.js'
import '../lease/house.js'
import '../lease/contract.js'

let zltype = true;//pjw

let val = location.search.substring(1);
val = decodeURIComponent(val);
console.log('当前是：', val);

$('.zl').children().show();

switch (val) {//pjw
    case "客户管理":
        hideTab();
        $('#customerManagement').show();
        $('.y1').attr('class', 'main-left-li-active');
        break;
    case "车位租赁":
        hideTab();
        $('#carRental').show();
        $('.y2').attr('class', 'main-left-li-active');
        break;
    case "广告位租赁":
        hideTab();
        $('#advertisingLeasing').show();
        $('.y3').attr('class', 'main-left-li-active');
        break;
    case "房屋租赁":
        hideTab();
        $('#houseRent').show();
        $('.y4').attr('class', 'main-left-li-active');
        break;
    case "合同管理":
        hideTab();
        $('#contractManagement').show();
        $('.y5').attr('class', 'main-left-li-active');
        break;
}
// })
$("#main-left").on('click', '.y', function () {//pjw
    if (zltype == false) {
        zltype = true;
        $(this).parents('ul').children().show();
    } else {
        zltype = false;
        $(".zl li:not(:nth-of-type(1))").hide();
    };
})

//我自己的代码----------------------------------------------------------------------------------------------------------------------------------------------------------
$('#lease-ul').on('click', 'li', function () {
    const ids = $(this).prop('id');
    switch (ids) {
        case 'customer':
            hideTab();
            $('#customerManagement').show();
            break;
        case 'car':
            hideTab();
            $('#carRental').show();
            break;
        case 'advertising':
            hideTab();
            $('#advertisingLeasing').show();
            break;
        case 'house':
            hideTab();
            $('#houseRent').show();
            break;
        case 'contract':
            hideTab();
            $('#contractManagement').show();
            break;

    }
});

//隐藏main中所有模块div
function hideTab() {
    $('#customerManagement').hide();
    $('#carRental').hide();
    $('#advertisingLeasing').hide();
    $('#houseRent').hide();
    $('#contractManagement').hide();
}


